﻿using System.Collections.Generic;
using Entitas;
using System.Linq;

class EnemyAddDropItemSystem : IExecuteSystem
{
    EnemyContext enemyContext;
    System.Random numgenerator;
    public EnemyAddDropItemSystem(Contexts contexts)
    {
        enemyContext = contexts.enemy;
         numgenerator = new System.Random();

    }


    public void Execute()
    {
        foreach (var e in enemyContext.GetEntities().Where(x=>x.hasName))
        {
            string enemyname = e.name.value.Remove(e.name.value.IndexOf(' '));
            ServiceManager.DebugMessageService.Print(enemyname);
            switch (enemyname)
            {
                case "Hornet":
                    int random = numgenerator.Next(1, 100);
                    //   ServiceManager.DebugMessageService.Print(random.ToString());
                    if (1 <= random && random <= 75)
                    {
                        ServiceManager.DebugMessageService.Print("dropped wood");
                       
                    }
                    else ServiceManager.DebugMessageService.Print("dropped heart");
                    break;
                default:
                    break;
            }
        }
    }
}
